package com.jinlejia.erp.ui.house;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.jinlejia.erp.R;
import com.jinlejia.erp.adapter.RentAdapter;
import com.jinlejia.erp.common.RecycleViewDivider;
import com.jinlejia.erp.databinding.ActivitySelectedBinding;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * 已选房源
 */
public class SelectedActivity extends AppCompatActivity {

    RentAdapter adapter;

    private ActivitySelectedBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this,R.layout.activity_selected);

        binding.btBack.setOnClickListener(this::onClick);
        binding.btSubmit.setOnClickListener(this::onClick);

        binding.rvList.setHasFixedSize(true);
        binding.rvList.setLayoutManager(new LinearLayoutManager(this));
        ArrayList<Map<String,Object>> list = new ArrayList();
        for( int i = 0; i< 20;i++ ){
            list.add(new HashMap<>());
        }
        adapter = new RentAdapter(list,"CHECK");
        binding.rvList.setAdapter(adapter);
        binding.rvList.addItemDecoration(new RecycleViewDivider(
                this, LinearLayoutManager.VERTICAL, 2, getResources().getColor(R.color.colorDivider)));
    }


    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_back:
                finish();
                break;
            case R.id.bt_submit:
                finish();
                break;
            default:
                break;
        }
    }
}
